Skip to content

fix(plugin-grid): the row menu offers no Delete on a line whose master is held - #37296

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-37231-grid-master-held-hide-delete
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-37231-grid-master-held-hide-delete

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37231
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:列表页和相关列表里,主单正在审批中的明细行(如费用报销明细),行菜单和选中栏不再出现「删除」;自身在审批中的记录仍可删除。
  • 为什么做:审批锁定的列表收口工作的一部分,服务端早已拒绝这种删除,界面现在提前不提供。
  • 出错会怎样:最坏情况是某行该删的「删除」被隐藏或仍然出现;只影响按钮显示,不写数据,可直接撤回。
  • 要你做什么:无

What changes

  • useRowApprovalLocks now keeps the batch lock door's lockSource ('record' or 'master') for a row answered locked: true, and exposes heldByMaster(recordId). It answers true only for a row a read answered lockSource: 'master'. A 501, a null entry, a failed or unasked read, and a record-held row all answer false.
  • The grid's row CRUD verdict (objectGridActionsColumn.tsx) ANDs !heldByMaster into canDelete. The row menu, the row context menu and the list page's single-row selection bar all read the same rowActionMenuProps, so they all drop Delete on a master-held line. A record-held row keeps Delete and loses Edit, as before ([finding] 删除记录后,它的审批单仍留在审批收件箱:pending 与 approved 两种都留,记录引用退化为原始 id #13568).
  • ObjectGrid.tsx: the lock hook is also enabled, and the demand probe also sent, on a grid whose rows offer Delete but no Edit (rowMenuReadsLocks = (canEdit && onEdit) || (canDelete && onDelete)). Without this, a Delete-only grid never read the lock and kept Delete on a master-held line. The read is still sent only on demand, never on first paint.
  • The column docblock and the ObjectGrid.tsx hook comment no longer say that a master-held line keeps Edit and Delete.
  • One patch changeset for @object-ui/plugin-grid.

Read first, in order of risk:

  1. ui/packages/plugin-grid/src/ObjectGrid.tsx, the rowMenuReadsLocks hunk: a Delete-only grid now sends a lock read when a row's actions are reached for.
  2. ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts, the answered.set hunk: lockSource is kept only on a locked: true entry, and only for one of the two values.
  3. ui/packages/plugin-grid/src/objectGridActionsColumn.tsx, the canDelete line.

Two-minute check: cd ui && pnpm exec vitest run packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx should report 10 passed, including the three tests under objectstack#37231.

Tests

The new pins are a top-level describe in the existing harness rowMenuApprovalLock-36911.test.tsx:

  • A master-held line offers neither Edit nor Delete. A record-held sibling offers no Edit and keeps Delete. An open sibling offers both (the control).
  • A grid with onDelete and no onEdit reads the lock on demand and drops Delete on the master-held line. The open row keeps Delete.
  • On the list page selection bar, a master-held line offers neither. A record-held sibling keeps Delete, and there is one lock read in total.
  • The 501, null and failed-read controls now include a master-held line, and each leaves its menu unchanged.

Acceptance notes

  • The cell-select path (describeCell → approvalLocked) still reads only the boolean. Both lock kinds refuse an update, so the boolean is enough there.
  • A locked: true entry with no lockSource (an older server) reads as record-held, which is the behaviour before this PR.
  • Not measured in a browser against the showcase expense lines. The pins drive the real ObjectGrid against a fake lock door.
  • The ablation proves only the master arm in the column verdict. The rowMenuReadsLocks widening has no ablation of its own. Its pin is the Delete-only test, which went red under the column ablation only because that ablation removes the downstream effect.

Verification

All readings below were taken at commit 929d5f0 in objectstack.

Harness file, plugin-grid suite, type-check
harness: cd ui && vitest run packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx
 Test Files  1 passed (1)
      Tests  10 passed (10)
os-verify-lock: VERDICT command-exit 0

plugin-grid suite: cd ui && vitest run --maxWorkers=2 packages/plugin-grid/
 Test Files  313 passed (313)
      Tests  2786 passed (2786)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @object-ui/plugin-grid type-check
os-verify-lock: VERDICT command-exit 0
Ablation: drop the master arm
node scripts/ablation-replace.mjs --file ui/packages/plugin-grid/src/objectGridActionsColumn.tsx --anchor " && !heldByMasterAnswered(row)" --delete -- (vitest on the harness file)
ablation-replace: ok mutation landed: anchor 1 -> 0, blob d9d2a5403f50 -> 2fcebc3668cf
     x a master-held line offers neither Edit nor Delete; a record-held sibling offers no Edit and keeps Delete
     x a grid whose rows offer Delete but no Edit still reads the lock, and drops Delete on the master-held line
     x the list page selection bar: a selected master-held line offers neither; a selected record-held sibling keeps Delete
      Tests  3 failed | 7 passed (10)
ablation-replace: ok restored: blob == HEAD (d9d2a5403f50) and `git diff HEAD` is empty

Two earlier attempts were refused or invalid and are not counted. The first used the anchor with a trailing comma and the replacement ,: the tool refused it as a no-op and restored the file before any test ran. The second deleted the comma along with the anchor: that broke the syntax, so the file collected no tests.


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Final head for L1 (p2) · area a4-U · 2026-11-25T13:42Z
Head-sha: 929d5f0d6865c50aa8c0715d2028b8f369638a20

Card #37231. Dev report: 7163984482.

  • Fix:

    • useRowApprovalLocks keeps the batch lock door's lockSource on a locked: true entry and exposes heldByMaster(recordId). It is true only for a row a read answered lockSource: 'master'.
    • The grid's row CRUD verdict (objectGridActionsColumn.tsx) ANDs !heldByMaster into canDelete. The row menu, the context menu and the list-page selection bar all read rowActionMenuProps, so all three drop Delete on a master-held line.
    • A record-held row keeps Delete and loses Edit, as before. A 501, a null entry, or a failed or unasked read leaves the menu unchanged.
    • The column docblock and the hook comment are updated.
  • Declared widening, in Acceptance notes: ObjectGrid.tsx now also enables the lock read on a grid whose rows offer Delete but no Edit (rowMenuReadsLocks). Without it, a Delete-only grid never reads the lock. This is inside the claimed file. It has no separate ablation; pin (2) below covers it.

  • Pins, in the top-level describe objectstack#37231 in rowMenuApprovalLock-36911.test.tsx:

    1. A master-held row offers neither Edit nor Delete. The record-held sibling keeps Delete, and the open sibling offers both.
    2. A Delete-only grid drops Delete on the master-held line.
    3. The list-page selection bar does the same, with one lock read in total.

    The 501, null and failed-read controls now include a master-held row, and stay green.

  • Ablation: deleting && !heldByMasterAnswered(row) turns all three master pins red (3 failed, 7 passed). Restored to blob == HEAD. Two earlier attempts collected no tests (one was a refused no-op, one a syntax break) and are not counted.

  • Readings, from the dev:

    • harness 10 of 10;
    • plugin-grid 313 files and 2786 tests;
    • type-check exit 0;
    • 39 of 39 dispatch-gates families exit 0.

    Overlap-check is clean; feat(spec,console): ask_ai action type — focus the in-app assistant on a record #37215 shares two files but merges cleanly.

  • Size: +148 −28 across 5 files, not governed.

  • Check-runs at this head: 40 success, 13 skipped, 0 failing or pending.

  • K: 9.

Handed to the seat session for L1.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 929d5f0d6865c50aa8c0715d2028b8f369638a20 · 2026-11-25T14:27Z

Card #37231 (p2, size S). Checked against GitHub and a local run at the head, not against the dev report. Merge base 4ed453dc211f, net diff +148 −28 across 5 files. All 5 files are inside the claim's file surface. Not a governed surface, and none of the four contract faces is touched, so no L2 is owed.

Checklist

  • PR shape: draft, base main, body line 1 Fixes #37231. The card is open and carries no needs-user-decision. A closing-keyword scan of the full body finds only that one hit. The body has no content/docs/releases/ or skills/** change, so no Skills-docs: line is owed (kind none, no arm).
  • Fix matches the card. useRowApprovalLocks keeps lockSource only on a locked: true entry, and only for 'record' or 'master'. heldByMaster is true only for an answered 'master'. rowCrudVerdicts ANDs !heldByMasterAnswered(row) into canDelete, and Edit keeps its isLocked gate. The row menu, the context menu and the list-page selection bar all read rowActionMenuProps, so each one follows. A 501, a null entry, or a failed or unasked read leaves heldByMaster false. The server side agrees: recordLockAnswer returns master first (approval-service.ts:2256), and bindDetailRowLockHook throws code = 'RECORD_LOCKED'.
  • Declared extension: rowMenuReadsLocks = (canEdit && !!onEdit) || (canDelete && !!onDelete) replaces rowMenuOffersEdit in the hook enable and in demandRowActions. This is right, and the card's reach needs it. RelatedList wires onEdit only when onRowEdit is set (RelatedList.tsx:3981-3982), so without the extension a related list over lines that offers Delete but no Edit would never read the lock. Nothing else changes behaviour. describeCell and onCellSelect still gate on hostCellSelection and read only the boolean. The hook fetches only from probe, never on mount. The comment and docblock edits make the comments true, and git grep at the head finds no remaining "keeps Edit and Delete" or #37041 claim in plugin-grid.
  • Clause-②: no is correct. ApprovalLockSource (new export) and RowApprovalLocks.heldByMaster (new member) live in hooks/useRowApprovalLocks.ts, and index.tsx does not re-export that file. I built @object-ui/plugin-grid at the head and walked the .d.ts import graph from dist/index.d.ts: 29 files are reachable, and none names RowApprovalLocks, heldByMaster, ApprovalLockSource, useRowApprovalLocks or objectGridActionsColumn. The positive control RowActionMenuProps appears in index.d.ts. The only .d.ts carrying the new names is dist/hooks/useRowApprovalLocks.d.ts. That file is shipped bytes, but exports maps only . and ./style.css, so it is not addressable and not public surface.
  • Metadata-protocol: none is correct: nothing a metadata author can write changes. The changeset is a single '@object-ui/plugin-grid': patch (private unset, so the package is published). Kind none takes patch. Both declaration lines open the changeset body.
  • Changeset sentences, checked one by one against the diff: the door path POST /api/v1/approvals/records/:object/locks matches useRowApprovalLocks.ts. "A row answered lockSource: 'master' offers neither Edit nor Delete", "a row answered 'record' … keeps Delete", the selection-bar sentence, and the 501, null, failed and unasked sentence each match the code and a pin. "A grid whose rows offer Delete but no Edit now also reads the locks … still never sent on first paint" matches the code: the only caller of probe on this path is demandRowActions.
  • 维护者速读, checked line by line against the diff. Line 1 「主单正在审批中的明细行…行菜单和选中栏不再出现「删除」;自身在审批中的记录仍可删除」 matches the verdict and pins (1) and (3). Line 2 「服务端早已拒绝这种删除,界面现在提前不提供」 matches the server's RECORD_LOCKED refusal. Line 3 「只影响按钮显示,不写数据,可直接撤回」 holds: the diff touches only the menu verdict and a read-only POST lock query. Line 4 「无」. The section has no code names, paths or bare card numbers.

Spot readings (local, throwaway worktree, closure built with pnpm --filter '@object-ui/plugin-grid^...' build)

  • Head 929d5f0d, harness rowMenuApprovalLock-36911.test.tsx: Test Files 1 passed, Tests 10 passed. This includes the three objectstack#37231 pins.
  • Ablation A: deleting && !heldByMasterAnswered(row) gives the mutated blob 2fcebc3668cf, the same blob the dev reported. Result: 3 failed | 7 passed, and all three failures are the #37231 pins.
  • Ablation B, which the dev did not run: reverting rowMenuReadsLocks to canEdit && !!onEdit gives 1 failed | 9 passed. The one failure is exactly pin (2), "a grid whose rows offer Delete but no Edit …". The extension is pinned independently.
  • Ablation C: making the hook drop lockSource gives 3 failed | 7 passed, again the three #37231 pins.
  • After each ablation, the blobs were restored and re-hashed: d9d2a5403f50 / 5049f60b2c57 / ac42fcb38810, each equal to HEAD:<path>.
  • Merge probe (the merge-tree result committed locally over origin/main 08bf7d2a41a7, closure rebuilt):
    • plugin-grid suite: Test Files 314 passed, Tests 2787 passed.
    • plugin-detail RelatedList* (59 files): Test Files 59 passed, Tests 387 passed. This covers the consumer that renders a grid with Delete but no Edit.
  • Check-runs at 929d5f0d (53 in total): 40 success, 13 skipped, 0 failure, 0 pending. Lint & Repo Gates, TypeScript Type Check, Type Check UI, Lint UI and Check Changeset are each success. The Test UI rollup and its 11 planned shards (Plan Test UI shards: mode=affected, 3953 of 7181 files) are success. Build & E2E UI and Live E2E UI are success. The skips are path-selected or opt-in legs (Build Core, Test Core shards, Dogfood matrix, Packed-tarball smoke, among others).
  • git merge-tree --write-tree origin/main 929d5f0d exits 0 with tree dadb00773557, so there is no conflict. Since the merge base, origin/main has advanced 10 commits. feat(spec,console): ask_ai action type — focus the in-app assistant on a record #37215 (ask_ai) touches ObjectGrid.tsx and objectGridActionsColumn.tsx in disjoint hunks, and the merge-probe suite above covers that pairing.
  • Overlaps: fix(console): a related tab's New keeps the parent it prefills when the child's relationship lookup declares dependsOn #37283 (11 files) and fix(ui): the related tab's create-only add entry reads New, not Add #37293 (3 files) share no file with this PR. Neither diff touches onEdit, onDelete or the grid wiring in RelatedList.tsx, so there is no semantic overlap.

No must-fix, no should-fix.

  • N1 — In a related list on the master's own record page, every line is master-held. In a grid that offers Delete but no Edit there, the first reach for a row's ⋮ shows Delete while the read is on the wire. Once the read answers, each row offers nothing, so the Actions column stops drawing (drawActionsColumn reads data.some(rowOffersAction)). This is the same fail-open shape 记录页的相关列表:服务端已锁定(RECORD_LOCKED)的行仍提供编辑和删除,点了才知道被锁 #36911 ships for Edit, so it is consistent with the design. It is recorded so that a reader of the showcase expense lines is not surprised.

  • N2 — Pin (2) does not assert zero lock reads before the demand in a grid that offers Delete but no Edit. The #36911 test "reads no lock before a row's actions are reached for" pins that only for a grid that offers Edit. The code path is shared (demandRowActions is the only probe caller off the cell path), so this costs no confidence today.

  • N3 — ApprovalLockSource restates the client's inline 'record' | 'master' union (packages/client/src/index.ts:7182). The hook reads the door through raw apiFetch rather than the client, so there is no shared type to import. This is a note only.

  • Landing: the zone lands it. K is 10, below 15, so no merge of main is needed first. Before arming it, check that Lint & Repo Gates and TypeScript Type Check read success at the head being queued.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Landing · area a4-U · 2026-11-25T14:28Z · head 929d5f0d6865c50aa8c0715d2028b8f369638a20

reading value
L1 ACCEPT 7165315525 (seat repo:objectstack#4) at this head; no must-fix or should-fix, and N1–N3 are notes
check-governed-merges.mjs --pr 37296 NOT governed · 176 changed lines ≤ 3000
check-runs at this head 40 success, 13 expected skip, 0 failed, 0 pending
K 10 (< 15), so no main merge first
overlap-check clean

State change: ready for review, and auto-merge is armed. The queue lands it. On MERGED, #37231 closes through Fixes #37231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid row menu: hide Delete on a master-detail line whose master is held (lockSource: 'master'), now that the lock reads say which kind of lock it is

2 participants